<template>
  <ant-modal
    modalWidth="584"
    modalHeight="800"
    :visible="open"
    :modal-title="formTitle"
    :adjust-size="true"
    @cancel="cancel"
  >
    <a-form-model ref="form" :model="form" :rules="rules" slot="content" layout="vertical">
      <a-row :gutter="32">
        <a-col :span="24">
          <a-form-model-item label="商品名称" prop="goodsName">
            <a-input v-model="form.goodsName" placeholder="请输入商品名称"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="商品描述" prop="goodsDes">
            <a-textarea v-model="form.goodsDes" placeholder="请输入商品描述" :rows="4"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="商品价格(元)" prop="price">
            <a-input-number v-model="form.price" :min="0" style="width: 100%"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="商品重量(kg)" prop="weight">
            <a-input-number v-model="form.weight" :min="0" style="width: 100%"/>
          </a-form-model-item>
        </a-col>
        <a-col :span="24" >
          <a-form-model-item label="商品类别" prop="category">
            <a-select
              placeholder="请选择商品类别"
              v-model="form.category"
              :getPopupContainer="
                triggerNode => {
                  return triggerNode.parentNode || document.body
                }
              "
              style="width: 100%"
              allow-clear>
              <a-select-option v-for="(d, index) in categoryOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="24" >
          <a-form-model-item label="供应商" prop="category">
            <a-select
              placeholder="请选择供应商"
              v-model="form.category"
              :getPopupContainer="
                triggerNode => {
                  return triggerNode.parentNode || document.body
                }
              "
              style="width: 100%"
              allow-clear>
              <a-select-option v-for="(d, index) in categoryOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="有效期" prop="validity">
            <a-date-picker
              v-model="form.validity"
              valueFormat="YYYY-MM-DD"
              :show-today="true"
              placeholder="选择日期"
              style="width: 100%"
            />
          </a-form-model-item>
        </a-col>
        <a-col :span="24" >
          <a-form-model-item label="状态" prop="state">
            <a-select
              placeholder="请选择状态"
              v-model="form.state"
              :getPopupContainer="
                triggerNode => {
                  return triggerNode.parentNode || document.body
                }
              "
              style="width: 100%"
              allow-clear>
              <a-select-option v-for="(d, index) in stateOptions" :key="index" :value="d.dictValue">{{ d.dictLabel }}</a-select-option>
            </a-select>
          </a-form-model-item>
        </a-col>
        <a-col :span="24">
          <a-form-model-item label="备注" prop="remark">
            <a-input v-model="form.remark" placeholder="请输入备注"/>
          </a-form-model-item>
        </a-col>
      </a-row>
    </a-form-model>
    <template slot="footer">
      <a-button :disabled="disabled" @click="cancel">
        取消
      </a-button>
      <a-button type="primary" :disabled="disabled" @click="submitForm(true)">
        保存
      </a-button>
    </template>
  </ant-modal>
</template>
<script>
import BaseGoodsinfoAddForm from './BaseGoodsinfoForm'
export default {
  ...BaseGoodsinfoAddForm
}
</script>
